package org.corey.wyp.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	import org.corey.wyp.business.PropertyManagerDelegate;
	import org.corey.wyp.model.ProperityModelLocator;
	import org.corey.wyp.vo.AccountItem;
	import org.corey.wyp.vo.Calendar;
	
	public class SearchOldAccountCommand implements ICommand,IResponder
	{
		public function SearchOldAccountCommand()
		{
		}
		
		public function execute(event:CairngormEvent):void{
			var dateString:String=String(event.data);
			var numArray:Array=dateString.split("-");
			var year:int=numArray[0];
			var month:int=numArray[1];
			var date:int=numArray[2];
			var pm:PropertyManagerDelegate=new PropertyManagerDelegate(this);
			pm.getCalendarAccount(year,month,date);
//			ProperityModelLocator.getInstance().application.selectedDate;
//			var t1:AccountItem=new AccountItem();
//			t1.itemName="a";
//			t1.itemOut=33;
//			t1.itemType="atype";
//			
//		
//			
//			var ts:ArrayCollection=new ArrayCollection();
//			
//			ts.addItem(t1);
//			ProperityModelLocator.getInstance().application.selectedDateAccountItems.addItem(t1);
//			ProperityModelLocator.getInstance().application.selectedDateAccountItems.addItem(t2);
//			ProperityModelLocator.getInstance().application.selectedDateAccountItems.addItem(t3);
//			ProperityModelLocator.getInstance().application.selectedDateAccountItems.addItem(t4);
//			ProperityModelLocator.getInstance().application.findSelectDateAccountItems(ts);
		}
		
		public function result(event:Object):void{
			var c:Calendar=Calendar(event.result);
			ProperityModelLocator.getInstance().application.selectedSearchCalendar=c;
		}
		
		public function fault(info:Object):void{
			Alert.show("增加信息失败:"+info);
		}

	}
}